﻿using System.Collections.Generic;
using System.Reflection;

namespace MadMediaManager.Core.Interfaces.Domain
{
    /// <summary>
    /// Interface for an entity that can be saved and retrieved from a data store.
    /// </summary>
    /// <typeparam name="TId">The data type of the unique identifier</typeparam>
    public interface IEntity<TId>
    {
        /// <summary>
        /// The data store unique identity of the object.
        /// </summary>
        TId EntityId { get; set; }

        /// <summary>
        /// Transient objects are not associated with an item already in storage.  For instance,
        /// a Customer is transient if its Id is 0.  It's virtual to allow NHibernate-backed 
        /// objects to be lazily loaded.
        /// </summary>
        bool IsTransient();

        /// <summary>
        /// Gets the properties which make up 
        /// the "domain signature" of the object. 
        /// Signature properties are not necessary for entities using natural keys.
        /// </summary>
        /// <returns></returns>
        IEnumerable<PropertyInfo> GetSignatureProperties();
    }
}
